#ifndef __LEDD_H
#define __LEDD_H


#include <rtdef.h>
#include <rtthread.h>
#include "cpuHc32f460.h"
#include <stdio.h>
#include "hc32f460.h"
#include "hc32_ddl.h"
#include "hc32f460_timera.h"
#include "hc32f460_gpio.h"
#include "anv_leaks.h"

#define LIGHT_RUN_OPEN              PORT_ResetPortData(PortB,Pin15)       // 运行灯开关
#define LIGHT_RUN_STOP				PORT_SetPortData(PortB,Pin15)
#define LIGHT_RUN_TOGGLE			PORT_Toggle(PortB,Pin15)

#define LIGHT_PWR_OPEN              PORT_SetPortData(PortD,Pin08)       // 电源灯开关
#define LIGHT_PWR_STOP				PORT_ResetPortData(PortD,Pin08) 
#define LIGHT_PWR_TOGGLE			PORT_Toggle(PortD,Pin08)
                                                                                              
#define WARN_ALARMR_ON              PORT_ResetPortData(PortC,Pin01)        //告警灯,红灯
#define WARN_ALARMR_OFF             PORT_SetPortData(PortC,Pin01)
#define WARN_ALARMR_TOGGLE          PORT_Toggle(PortC,Pin01)

#define WARN_ALARMY_ON              PORT_ResetPortData(PortC,Pin00)        //告警灯,黄灯
#define WARN_ALARMY_OFF             PORT_SetPortData(PortC,Pin00)
#define WARN_ALARMY_TOGGLE          PORT_Toggle(PortC,Pin00)
                                                                                            
#define LIGHT_COMM_OPEN             PORT_ResetPortData(PortD, Pin10)	  // 通讯灯开关, 上行灯
#define LIGHT_COMM_STOP             PORT_SetPortData(PortD, Pin10) 
#define LIGHT_COMM_TOGGLE		    PORT_Toggle(PortD,Pin10)
#define LIGHT_COMM_GET		        PORT_GetBit(PortD,Pin10)                       
                                                                                        
#define LIGHT_COMMDOWN_OPEN         PORT_ResetPortData(PortD, Pin09)	  // 通讯灯开关, 下行灯
#define LIGHT_COMMDOWN_STOP         PORT_SetPortData(PortD, Pin09) 
#define LIGHT_COMMDOWN_TOGGLE       PORT_Toggle(PortD,Pin09)
#define LIGHT_COMMDOWN_GET		    PORT_GetBit(PortD,Pin09) 
                                                                                        
#define WARN_STAGR_ON               PORT_ResetPortData(PortC,Pin03)        //告警灯,红灯
#define WARN_STAGR_OFF              PORT_SetPortData(PortC,Pin03)
#define WARN_STAGR_TOGGLE		    PORT_Toggle(PortC,Pin03)
//  
#define WARN_STAGG_ON               PORT_ResetPortData(PortC,Pin02)        //告警灯，绿灯
#define WARN_STAGG_OFF              PORT_SetPortData(PortC,Pin02)
#define WARN_STAGG_TOGGLE		    PORT_Toggle(PortC,Pin02)          

extern void led_thread_entry(void *parameter);
void Led_gpio_device_unregister(void);
int Led_gpio_device_register(void);

typedef struct my_gpio_device
{
    struct rt_device parent;    // 继承自 RT-Thread 设备基类
}gpio_device;

#endif